#pragma pack(1)

#define MESSAGE_TITLE "ageo|Minerva"

typedef struct _CONFIG_{
	short winpx, winpy;
	short windx, windy;
	char currentDir[300];
	char paletteDir[300];
	char applicationDir[300];
	BOOL isMaximized;
	short colordlgpx, colordlgpy;
} *PCONFIG, CONFIG;

typedef struct _DATA_ *PDATA;

typedef LRESULT (*TOOL_CALLBACK)(HWND hwnd, PDATA data, UINT message, PVOID param);

typedef struct _DATA_ {
	PIMAGE image;
	PCONFIG config;
	BOOL changed;
	char fileName[300];
	// Board
	int px, py;
	int scale;
	// Current colors
	COLORREF colorInk;
	COLORREF colorPaper;
	COLORREF colorPainter;
	COLORREF colorBorder;
	TOOL_CALLBACK currentTool;
	// Optimal painting
	int xyOffset;
	HCURSOR cursor;
} DATA;

PDATA dataCreate();

void dataFreeData(PDATA data);

PCONFIG dataLoadConfig();

void dataSaveConfig(PCONFIG config);

IMAGE_CALLBACK dataDetermineReader(char *fileName);

COLORREF dataGetColor(PDATA data, int x, int y);

void dataSetColor(PDATA data, COLORREF color);

char *dataFileExtension(char *fileName);